home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 27 / CU Amiga Magazine's Super CD-ROM 27 (1998)(EMAP Images)(GB)[!][issue 1998-10].iso / CUCD / Programming / THXPlayLib / src / multisong.asm < prev    next >
Encoding:
Assembly Source File  |  1998-05-10  |  2.4 KB  |  108 lines

  1. ;****** thxplay.library/thxGetNumSongs ******************************************
  2. ;
  3. ;   NAME
  4. ;       thxGetNumSongs -- get number of subsongs.
  5. ;
  6. ;   SYNOPSIS
  7. ;       songs = thxGetNumSongs()
  8. ;       D0-0:7
  9. ;
  10. ;       ULONG thxGetNumSongs(void);
  11. ;
  12. ;       songs := thxGetNumSongs()
  13. ;
  14. ;   FUNCTION
  15. ;       Returns  the  number  of subsongs in the module, if any. You can use
  16. ;       the  thxSetSong()  function  to  play one of the subsongs, if that's
  17. ;       possible.
  18. ;
  19. ;   RESULT
  20. ;       songs - 0 if there are no subsongs (only the main song), otherwise
  21. ;               returns the number of subsongs.
  22. ;
  23. ;   SEE ALSO
  24. ;       thxSetSong()
  25. ;
  26. ;****************************************************************************
  27. ;
  28. ;
  29.     cnop    0,4
  30. thxGetNumSongs
  31.     move.l    THX+thxBSS_P(pc),d0
  32.     beq.s    .exit
  33.     move.l    d0,a0
  34.     moveq    #0,d0
  35.     move.b    thx_pSubsongs(a0),d0
  36. .exit    rts
  37.  
  38.  
  39.  
  40.  
  41. ;****** thxplay.library/thxSetSong ******************************************
  42. ;
  43. ;   NAME
  44. ;       thxSetSong -- set song to be played.
  45. ;
  46. ;   SYNOPSIS
  47. ;       thxSetSong(song)
  48. ;                  D0-0:7
  49. ;
  50. ;       void thxSetSong(ULONG);
  51. ;
  52. ;       thxSetSong(song)
  53. ;
  54. ;   FUNCTION
  55. ;       Sets  which  song  to play, if a module contains more than one song.
  56. ;       Most  modules  only  contain  one  song,  but  some  modules contain
  57. ;       sub-songs  as  well  as  the  main one. You can use this function to
  58. ;       specify  which  one  should be played. If you call this function and
  59. ;       there is already a song playing, it will be stopped first.
  60. ;
  61. ;   INPUTS
  62. ;       song - 0 to set the main song to be played, any other number will
  63. ;              change to that subsong, if it exists. Otherwise, no change
  64. ;              will be made (other than the stoppage).
  65. ;
  66. ;   NOTE
  67. ;       It is up to you to start playing the module again.
  68. ;
  69. ;   SEE ALSO
  70. ;       thxGetNumSongs()
  71. ;
  72. ;****************************************************************************
  73. ;
  74. ;
  75.     cnop    0,4
  76. thxSetSong
  77.     ifnd    STACKARGS
  78.     move.l    d0,-(sp)
  79.     endc
  80.  
  81.     bsr    thxStop            ; stop and get maximum no. of songs
  82.     bsr.s    thxGetNumSongs
  83.  
  84.     ifd    STACKARGS
  85.     move.l    4(sp),d1
  86.     else
  87.     move.l    (sp)+,d1
  88.     endc
  89.  
  90.     cmp.l    d0,d1
  91.     bhi.s    .exit            ; exit if wanted (d1) > maximum (d0)
  92.     move.l    d1,d0
  93.     move.b    mod_OK(pc),d1
  94.     beq.s    .exit
  95.     lea    song(pc),a0
  96.     move.w    d0,(a0)            ; store this new subsong
  97.     movem.l    d2-d7/a2-a6,-(sp)
  98.     moveq    #1,d1
  99.     bsr    THX+thxInitSubSong    ; change to this subsong
  100.     movem.l    (sp)+,d2-d7/a2-a6
  101. .exit    rts
  102.  
  103.  
  104.  
  105.  
  106. ; VARIABLES
  107. song    dc.w    0    ; UWORD subsong currently playing
  108.